﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using eBusiness.App_DAL;

namespace eBusiness.Controllers
{
    public class HomeController : Controller
    {
        private readonly UnitOfWork _unitOfWork = new UnitOfWork();

        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            return View();
        }

        public ActionResult About()
        {
            return View();
        }

        [HttpPost]
        public ActionResult GetSubMenu(int id)
        {
            var menus = _unitOfWork.CategoryRepository.Get(m => m.ParentID == id);
            return PartialView("_SubMenuPartial", menus.ToList());
        }
    }
}
